package mest.service.Modeling.Impl;

import mest.VO.Modeling.BomSaveFile_manytomany.savefileVO;
import mest.dao.Modeling.IbomDao;
import mest.entity.bom;
import mest.entity.bomsave_manytomany;
import mest.service.Modeling.IbomService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @auther Machenike
 * @create 2019-11-16 23:08
 */
@Service
public class bomServiceImpl implements IbomService {

    @Resource
    private IbomDao ibomDao;

    @Override
    public int insertBOMFile(bom bom) {
        try {
            return ibomDao.insertBOMFile(bom);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -1;

    }

    @Override
    public int selectCount() {
        return ibomDao.selectCount();
    }

    @Override
    public List<bom> findBOMFilePage(int index, int pageSize) {
        return ibomDao.findBOMFilePage((index-1)*pageSize,pageSize);
    }

    @Override
    public List<savefileVO> findSaveByBOMId(int bomid, int index, int pageSize) {
        return ibomDao.findSaveByBOMId(bomid,(index-1)*pageSize,pageSize);
    }

    @Override
    public int SaveCount(int id) {
        return ibomDao.SaveCount(id);
    }

    @Override
    public int insertManytomany_bomAndSave(bomsave_manytomany bsmtm) {
        return ibomDao.insertManytomany_bomAndSave(bsmtm);
    }

    @Override
    public int updateManytomany_bomAndSave(savefileVO bsmtm) {
        return ibomDao.updateManytomany_bomAndSave(bsmtm);
    }
}
